<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        window.onload=function(){
            console.log("文档加载结束");
        }
        //注册页面加载事件
window.addEventListener( 'load' , function() {
var div = document.querySelector( 'div');
1//注册调整窗口大小事件
window.addEventListener( 'resize', function() {
// window.innerlidth获取窗口大小
console.log('变化了');
if (window.innerWidth <= 888){
    div.style.display = 'none';
}else {
div.style.display = 'block';
}
})
})
//定时器
//超时定时器
setTimeout(function(){
console.log('2秒到了');
},2000)
//间隔定时器
var i=0;
var timer=setInterval(function(){
console.log('1秒到了');
i++;
if(i>10)
clearInterval(timer)
},1000)

    </script>

</body>
</html>